package com.ckx.config;

import lombok.extern.slf4j.Slf4j;
import org.apache.coyote.ProtocolHandler;
import org.springframework.boot.web.embedded.tomcat.TomcatProtocolHandlerCustomizer;
import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory;
import org.springframework.boot.web.server.WebServerFactoryCustomizer;
import org.springframework.context.annotation.Configuration;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;


@Slf4j
@Configuration
public class WebServerConfig
        implements WebServerFactoryCustomizer<TomcatServletWebServerFactory> {

    @Override
    public void customize(TomcatServletWebServerFactory factory) {
        // factory.setProtocol("org.apache.coyote.http11.Http11Nio2Protocol");
        /*ExecutorService executor = Executors.newVirtualThreadPerTaskExecutor();
        TomcatProtocolHandlerCustomizer<ProtocolHandler> handlerCustomizer = protocolHandler -> protocolHandler.setExecutor(executor);
        factory.getTomcatProtocolHandlerCustomizers().add(handlerCustomizer);*/
    }
}
